/**
 * Project Name:EMSInterfaceTest
 * File Name:ValuesetItemList.java
 * Package Name:functions.mams_rest
 * Date:2018年7月26日下午3:11:36
 * Copyright (c) 2018, crpcg@crpcg.com All Rights Reserved.
 *
 */

package functions.mams_rest;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;

import com.beans.PaymentModeDataBean;

import coms.Constants;
import frame.HttpHelper;
import frame.InterTest;

/**
 * ClassName:ValuesetItemList <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason:	 TODO ADD REASON. <br/>
 * Date:     2018年7月26日 下午3:11:36 <br/>
 * @author   JiangWu	
 * 点击发起付款准备链接 
 */
public class ValuesetItemList implements InterTest{
	String result;
	List<PaymentModeDataBean> paymentModeDataBeans; 
	
	public ValuesetItemList() {
	}
	
	/*
	 * valuesetUrl="/mams-rest/sys/valueset/item/list/PAYMENT_MODE"
	 */

	public void paymentMethod() {
		String url = Constants.VALUE_SET_URL;
		try {
			result = HttpHelper.post("", url);
			System.out.println("PAYMENT_MODE==================="+result);
			JSONObject jsonObject = new JSONObject(result);
			String statusCode = jsonObject.getString("statusCode");
			if(statusCode.equals("0")) {
				JSONArray array = jsonObject.getJSONArray("dataResult");
				paymentModeDataBeans = new ArrayList<PaymentModeDataBean>();
				for (int i = 0; i < array.length(); i++) {
					JSONObject json = (JSONObject) array.get(i);
					String vsiId = json.getString("vsiId");
					String vsiKey = json.getString("vsiKey");
					String vsiValue = json.getString("vsiValue");
					PaymentModeDataBean paymentModeDataBean = new PaymentModeDataBean(vsiId, vsiKey, vsiValue);
					paymentModeDataBeans.add(paymentModeDataBean);
				}
			}else {
				String msString = jsonObject.getString("msg");
				System.out.println(msString);
			}
			
		} catch (Exception e) {
			
			// TODO Auto-generated catch block
			e.printStackTrace();
			
		}
	}



	/**
	 * TODO 简单描述该方法的实现功能（可选）.
	 * @see frame.InterTest#run(java.util.HashMap)
	 */
	@Override
	public void run(Map<Object, Object> paramMap) {
	  paymentMethod();
		// TODO Auto-generated method stub
		
	}

  @Override
  public boolean getStatus() {
    // TODO Auto-generated method stub
    return false;
  }

  @Override
  public String getRemark() {
    // TODO Auto-generated method stub
    return null;
  }
	
}

